<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        border: solid;
        padding: 10px;
        margin: 10px;
      }
    </style>
  </head>
  <body>
    <div id="box1" onclick="console.log(this===event.target);">
      box1
      <div id="box2" onclick="console.log(this===event.target);">
        box2
        <div id="box3" onclick="console.log(this===event.target);">
          box3
          <div id="box4" onclick="console.log(this===event.target);">box4</div>
        </div>
      </div>
    </div>
    <script></script>
  </body>
</html>
